/*
* @Author: chenggh
* @Date: 2025-06-13
* @Link to Problem : https://oj.haizeix.com/problem/44
*/
#include <iostream>
using namespace std;
int a[1000005] = {0};
int dp[1000005] = {0};
int main(){
	int n; cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
	}
	dp[1] = 1;
	for(int i = 2; i <= n; i++){
		int tail = 0;
		for(int j = 1; j < i; j++){
			if(a[j] >= a[i]) continue;
			tail = max(tail, dp[j]);
		}
		dp[i] = tail + 1;
	}
	int ans = 0;
	for(int i = 1; i <= n; i++){
		ans = max(ans, dp[i]);
	}
	cout << ans << endl;
	return 0;
}